package com.jfire.json.util;

import java.lang.reflect.Type;
import com.jfire.baseutil.collection.ObjectCollect;
import com.jfire.baseutil.collection.StringCache;
import com.jfire.json.field.JsonField;

public interface JsonSerializer
{
    /**
     * 将对象src转换为json对象或者json数组
     * 
     * @param src
     * @param collect
     * @return
     */
    public Object transToJsonvalue(Object src, ObjectCollect collect);
    
    /**
     * 设置普通对象的jsonfields
     * 
     * @param jsonFields
     */
    public void setJsonFields(JsonField[] jsonFields);
    
    /**
     * 将对象值变成字符串写入builder中
     * 
     * @param cache
     * @param value
     * @param collect
     */
    public void writeToString(StringCache cache, Object value, ObjectCollect collect);
    
    /**
     * 将json对象或者json数组value按照类型type进行转换，返回转化后的object
     * 
     * @param value
     * @param type
     * @return
     */
    public Object toBean(Object value, Type type);
}
